package a31_CodeBlock;

/**
 * @Author quan
 * @Description 学生类
 * @Date 2023/3/9 15:48
 */
public class Student {
    private String name;
    private int age;
    static{
        System.out.println("静态代码块");//在Student类加载的时候就打印了，而且只打印一次
    }
    public Student() {
        System.out.println("无参构造");
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("有参构造");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
